import React from 'react';
import ReactDOM from 'react-dom';
import {Route, IndexRoute,} from 'react-router';
import {
  App,
  Home,
  NotFound,
  PayFa
} from './modules';
import Login from './modules/login'
import PersonMsg from './modules/personMsg'

export default (store) => {
  const requireAuth = (nextState, replace) => {
    if (!store.getState().auth.token) {
      replace('/login');
    }
  };

  return (

    <Route path="/" component={App}>
      <IndexRoute component={PayFa} onEnter={requireAuth}/>
      <Route path="login" component={Login}/>
	  <Route path="personMsg" component={PersonMsg}/>
      <Route path="home" component={Home}/>
        <Route path="pay" component={PayFa}/>
    </Route>
  );
}